package com.readboottest.entity.response;


import com.readboottest.constant.GlobalConstants;

/**
 * @author: yadongcui
 * @date: 2018-12-22 16:30
 * @description：响应
 */
public class BaseResponse<T> implements Response<T> {


    /**
     * 状态（success：成功， fail：失败）
     */
    protected String status = GlobalConstants.FAIL;

    /**
     * 消息
     */
    protected String message;


    /**
     * 业务code
     */
    protected String code;

    /**
     * 详细数据
     */
    public T result;

    private static BaseResponse response;

    public BaseResponse() {
    }

    public BaseResponse(String message) {
        this.message = message;
    }

    public BaseResponse(String status, String message) {
        this.status = status;
        this.message = message;
    }

    public BaseResponse(String status, T result) {
        this.status = status;
        this.result = result;
    }

    public BaseResponse(T result) {
        this.status = GlobalConstants.SUCCESS;
        this.result = result;
    }

    public BaseResponse(String status, String message, String code) {
        this.status = status;
        this.message = message;
        this.code = code;
    }

    public BaseResponse(String status, String message, String code, T result) {
        this.status = status;
        this.message = message;
        this.code = code;
        this.result = result;
    }


    @Override
    public String getStatus() {
        return status;
    }

    @Override
    public void setStatus(String status) {
        this.status = status;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public T getResult() {
        return result;
    }

    @Override
    public void setResult(T result) {
        this.result = result;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public void setCode(String code) {
        this.code = code;
    }

}
